package com.project.springboot.enums;

import com.project.springboot.annotation.ExcelEnum;
import lombok.Getter;

/**
 * description: 性别枚举类
 * @author 朱正磊
 * @date 2023-08-17 22:58:03
 */
@Getter
public enum SexEnum implements ExcelEnum<Integer> {

    MAN(1, "男"),
    WOMAN(2, "女")
    ;

    private final Integer code;

    private final String desc;

    SexEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getByCode(Integer code) {
        for (SexEnum value : SexEnum.values()) {
            if (value.getCode().equals(code)){
                return value.getDesc();
            }
        }
        return code.toString();
    }

}
